<%@ page import="model.app.Menu" %>
<%@ page import="services.managers.MenuManager" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:useBean id="bean" scope="session" class="bean.BeanSession"></jsp:useBean>
<%
    if (bean != null && bean.isActivo()) {
        MenuManager menuManager = new MenuManager();
        List<Menu> elementosMenus = menuManager.getMenu(bean);
        Iterator<Menu> it = elementosMenus.iterator();
%>
<div menu>
    <ul>
        <%
            while (it.hasNext()) {
                Menu menu = it.next();
        %>
        <li><a onclick="<%=menu.getAccion()%>"><%=menu.getTitulo()%>
        </a></li>
        <%
            if (menu.getHijos().size() > 0) {
        %>
        <ul>
            <%
                Iterator<Menu> it2 = menu.getHijos().iterator();
                while (it2.hasNext()) {
                    Menu menu1 = it2.next();
            %>
            <li><a onclick="<%=menu1.getAccion()%>"><%=menu1.getTitulo()%>
            </a></li>
            <%
                if (menu1.getHijos().size() > 0) {
            %>
            <ul>
                <%
                    Iterator<Menu> it3 = menu1.getHijos().iterator();
                    while (it3.hasNext()) {
                        Menu menu2 = it3.next();
                %>
                <li><a onclick="<%=menu2.getAccion()%>"><%=menu2.getTitulo()%>
                </a></li>
                <%
                    }
                %>
            </ul>
            <%
                    }
                }
            %>
        </ul>
        <%
                }
            }
        %>
    </ul>
</div>
<%
    }
%>